Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  properties: {
    visible: {
      type: Boolean,
      value: false
    },
    imageUrl: {
      type: String,
      value: ''
    }
  },
  
  data: {
    animationClass: ''
  },
  
  observers: {
    'visible': function(visible) {
      if (visible) {
        this.setData({ animationClass: 'popup-show' });
      } else {
        this.setData({ animationClass: 'popup-hide' });
        // 动画结束后真正隐藏组件
        setTimeout(() => {
          this.setData({ animationClass: '' });
        }, 300);
      }
    }
  },

  methods: {
    closePopup() {
      this.triggerEvent('close');
    },
    
    stopPropagation() {
      // 阻止事件冒泡
      return false;
    },
    
    callDDService() {
      wx.makePhoneCall({
        phoneNumber: '4009999999', // DD代驾电话
        success: () => {
          console.log('拨打DD代驾电话成功');
          this.closePopup();
        },
        fail: (err) => {
          console.log('拨打电话失败', err);
        }
      });
    }
  }
}); 